<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:common="http://www.contact.common.com/contacts/ui"
      xmlns:a4j="http://richfaces.org/a4j">

<ui:component>

    <common:modalPanel id="createRoomModalPanel"
                       header="#{resources.createchatLabel}"
                       bean="#{createChatBean}"
                       submitButton="#{resources.createchatCreateButton}"
                       oncomplete="this.form.reset();"
                       reRender="chatTabs, quickChatPanel, form_chatUserList"
            >

        <ui:define name="panelBody">
            <h:panelGrid columns="2">
                <h:outputLabel value="#{resources.createchatTopicLabel}" for="roomTopicInput"/>
                <h:inputText id="roomTopicInput" value="#{createChatBean.chatTopic}"
                        validatorMessage="#{resources.createchatTopicValidator}"
                        required="true" requiredMessage="#{resources.createchatTopicRequired}">
                    <f:validator validatorId="alphanumValidator"/>
                    <f:validateLength minimum="3"/>
                    <rich:ajaxValidator event="onblur"/>
                </h:inputText>

                <h:outputLabel id="newRoomPasswordLabel" value="#{resources.createchatPasswordLabel}" for="newRoomPasswordInput" style="display:none;"/>
                <h:inputSecret id="newRoomPasswordInput" value="#{createChatBean.chatPassword}" style="display:none;"
                        validatorMessage="#{resources.createchatPasswordValidator}">
                    <f:validator validatorId="alphanumValidator"/>
                    <rich:ajaxValidator event="onblur"/>
                </h:inputSecret>
            </h:panelGrid>

            <rich:messages/>

            <a4j:commandLink id="addRoomPassword"
                             value="#{resources.createchatAddPasswordLink}"
                             style="float:right; display:block;"
                             onclick="#{rich:element('newRoomPasswordLabel')}.style.display='block';
                             #{rich:element('newRoomPasswordInput')}.style.display='block';
                             this.style.display='none';"
                    />

        </ui:define>
    </common:modalPanel>


</ui:component>


</html>